<%--
  Created by IntelliJ IDEA.
  User: c
  Date: 2017-11-21
  Time: 10:25
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>采购计划审核明细信息</title>
    <%@include file="/WEB-INF/jsp/header.jsp"%>
</head>
<style>
    table td{
        font: 14px 'microsoft yahei', 微软雅黑, Helvetica, Arial, Tahoma, 黑体, 宋体, sans-serif;
    }
    div.title-pur p{
        margin-top: 10px;
        margin-bottom: 10px;
    }
</style>
<script src="${ctx}/statics/js/jquery-1.12.4.js"></script>
<body>
<div class="container-fluid">
    <div style="text-align: center;margin-bottom: 10px;">
        <span class="h3">审核销毁明细信息</span>
    </div>
    <div style="height: 35px; background-color: #F9F9F9; margin-top: 15px;">
        <label style="line-height: 35px; margin-left: 30px;"><i class="layui-icon" style="color: red;">&#xe623;</i>&nbsp;药品销毁申请信息</label>
    </div>
    <div class="container-fluid" style="width: 85%;">
        <div style="font-size: 16px; margin-top: 15px;" class="row">
            <div class="col-md-4 title-pur">
                <p><label>NO&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;：</label>&nbsp;${listDetails[0].desNum}</p>
                <p><label>处理方法：</label>&nbsp;${listDetails[0].destorymaster.desMode}</p>
            </div>
            <div class="col-md-4 title-pur">
                <p>
                    <fmt:formatDate value="${listDetails[0].destorymaster.desSubdate}" pattern="yyyy-MM-dd" var="data"></fmt:formatDate>
                    <label>计划提交日期：</label>&nbsp;${data}
                </p>
                <p>
                    <fmt:formatDate value="${listDetails[0].destorymaster.desDate}" pattern="yyyy-MM-dd" var="data2"></fmt:formatDate>
                    <label>计划销毁日期：</label>&nbsp;${data2}
                </p>
            </div>
            <div class="col-md-4 title-pur">
                <p><label>申请员：</label>&nbsp;${listDetails[0].destorymaster.worker.woName}</p>
            </div>
        </div>
        <div style="font-size: 15px;">
            <p>
                <label class=" pull-right"><span style="color: red;">审核状态：</span>
                    <span>${listDetails[0].destorymaster.desAuditstate==0?'待审核':pur.planChstate==1?'已通过':'未通过'}</span>
                </label>
            </p>
        </div>
        <table id="delTable" class="table table-bordered ">
            <tr class="back">
                <th rowspan="2" class="text-center">
                    <span style="line-height: 73px;">序号</span>
                </th>
                <th colspan="4" class="text-center">
                    药品信息
                </th>
                <th colspan="2">
                    供应商信息
                </th>
                <th colspan="2" class="text-center">
                    价格(人民币:元)
                </th>
            </tr>
            <tr class="back">
                <th >药品名称</th>
                <th >规格</th>
                <th >现有数量</th>
                <th >单位</th>
                <th>公司编号</th>
                <th>公司名称</th>
                <th >进价(元)</th>
                <th >小计</th>
            </tr>
            <c:forEach items="${listDetails}" var="p">
                <tr>
                    <td>${p.detId}</td>
                    <td>${p.druginfo.drugName}</td>
                    <td>${p.druginfo.drugStandard}</td>
                    <td class="delBuynum">${p.detNumber==null?0:p.detNumber}</td>
                    <td>${p.druginfo.drugUnit}</td>
                    <td>
                        ${p.provider.proNum}
                    </td>
                    <td>${p.provider.proName}</td>
                    <td>${p.detPrimecost}</td>
                    <td class="money" style="color: red;">
                        ￥<span><fmt:formatNumber type="number" value="${p.detNumber*p.detPrimecost}" pattern="0.00" maxFractionDigits="2"/></span>
                    </td>
                </tr>
            </c:forEach>
            <tr>
                <th colspan="3" style="text-align: right;">合计数量及金额：</th>
                <th>
                    <span id="num"></span>
                    <script>
                        var totalNum=0;
                        $("table#delTable td.delBuynum").each(function(){
                            totalNum+=parseInt( $(this).html());
                        });
                        $("span#num").html(totalNum)
                    </script>
                </th>
                <th colspan="4"></th>
                <th>
                    <span id="totalMo"></span>
                    <script>
                        var totalMoney=0.00;
                        $("table#delTable td.money").each(function(){
                            totalMoney+=parseFloat( $(this).find("span").html());
                        });
                        $("span#totalMo").html("￥"+totalMoney)
                    </script>
                </th>
            </tr>
        </table>
    </div>
    <div style="height: 35px; background-color: #F9F9F9; margin-top: 25px;">
        <label style="line-height: 35px; margin-left: 30px;"><i class="layui-icon" style="color: red;">&#xe623;</i>&nbsp;审核信息</label>
    </div>
    <div class="container-fluid" style="width:85%;">
        <form class="form-horizontal auditInfo">
            <input type="hidden" name="desNum" value="${listDetails[0].desNum}"/>
            <div class="form-group">
                <label for="" class="control-label col-md-2">
                    审核结果：

                </label>
                <c:if test="${listDetails[0].destorymaster.desAuditstate==2}">
                    <div class="form-group col-md-1">
                        <label style="color: red;" class="control-label">
                            未通过
                        </label>
                    </div>
                </c:if>
                <div class="form-group col-md-3">
                    <select class="form-control" name="desAuditstate" >
                        <option value="-1">--请选择--</option>
                        <option value="1">审核通过</option>
                        <option value="2">审核不通过</option>
                    </select>
                </div>
                <p class=" col-md-4" style="line-height: 34px; ">
                    <i style="color: red;">*</i>
                    <span style="color: red;" id="error"></span>
                </p>
            </div>
            <div class="form-group">
                <label for="" class="control-label col-md-2">审核意见：</label>
                <div class="form-group col-md-9">
                    <textarea placeholder="审核意见" class="layui-textarea" name="desViews"></textarea>
                </div>
            </div>
            <div class="text-center">
                <button type="button" class="btn btn-success baocun" onclick="baocun()"><i class="glyphicon glyphicon-share"></i>&nbsp;保存</button>&nbsp;&nbsp;&nbsp;
                <button type="button" class="btn btn-primary fanhui" onclick="fanhui()"><i class="glyphicon glyphicon-repeat"></i> &nbsp;返回</button>
            </div>
        </form>
    </div>
</div>
<%@include file="/WEB-INF/jsp/footer.jsp"%>
<script>

$(function () {
    $("[name=desAuditstate]").change(function () {
        $("#error").html("")
    })
})
    //保存键
    function baocun() {
        var planChstate = $("[name=desAuditstate]").val();
        if(planChstate==-1){
            $("#error").html("请审核结果")
            return;
        }

        var param = $("form.auditInfo").serialize();
        //修改审核状态
        $.post(ctx+"/audit/auditdes",param,function(flag){
            if(flag=="true"){
                swal({
                    title:"操作提示",
                    text:"审核成功!",
                    type:"success",
                }).then(function(){
                    location.href=ctx+"/audit/destoryPlan/index";
                })
            } else {
                toastr.error("操作提示","系统出错,审核失败!");
            }
        },"text");
    }
    //返回键
    function fanhui() {
        location.href=ctx+"/audit/destoryPlan/index";
    }
</script>
</body>
</html>
